<div class="smart-rightPanel layui-form">
    <div class="layui-anim layui-anim-upbit">
        <blockquote class="site-text layui-elem-quote">
            <div class="layui-form-item wx-search" id="list_form">
                <div class="layui-inline">
                    <input type="text" name="phone" placeholder="请输入手机号" autocomplete="off" class="layui-input">
                </div>
                <button class="layui-btn btn-primary" id="search">搜索</button>
            </div>
        </blockquote>
        <table id="list_table" class="layui-hide" lay-filter="mainList"></table>
    </div>
</div>
<script>
    layui.use(['layer', 'table', 'form','jquery'], function () {
        var layer = layui.layer;
        var table = layui.table;
        var form = layui.form;
        var  $ = layui.jquery;
        var tableObj = table.render({
            id: 'list_table'
            , elem: '#list_table'
            , url: 'buss/user'
            , where:{checkStatus:0,id:getHashParam().id,fid:getHashParam().fid}
            , align: "center"
            , cols: [[ //表头
                {field: 'id', title: '编号',align: 'center',hide:true}
                , {field: 'code', title: '邀请码', width: 140, align: 'center'}
                , {field: 'fname', title: '师傅', width: 140, align: 'center', templet: function (d) {
                       if(d.fname){
                           return '<a class="font-primary" href="views/index.html#/buss/user/list[id='+d.fid+']">'+d.fname+'</a>'
                       }else {
                           return ''
                       }
                    }}
                , {field: 'fname', title: '徒弟', width: 140, align: 'center', templet: function (d) {
                        return '<a class="font-primary" href="views/index.html#/buss/user/list[fid='+d.id+']">查看</a>'
                    }}
                , {field: 'headImg', title: '头像', width: 140, align: 'center'}
                , {field: 'phone', title: '电话', width: 140, align: 'center'}
                , {field: 'account', title: '账户', width: 50, align: 'center', templet: function (d) {
                        return '<a class="font-primary" href="views/index.html#/buss/accountLog/list[id='+d.id+']">'+d.account+'</a>'
                    }}
                , {field: 'account', title: '提现', width: 300, align: 'center', templet: function (d) {
                        return '<button class="layui-btn layui-btn-warm layui-btn-sm" lay-event="tixian">提现申请</button>'
                            +'<button class="layui-btn layui-btn-warm layui-btn-sm" lay-event="lishi">历史提现</button>'

                    }}
            ]]
            , done :function(res,curr,count){
                $(".layui-table-box").find("[data-field='id']").css("display","none");
            }
        });

        $("#search").click(function () {
            reloadTable(tableObj);
        });

        table.on('tool(mainList)', function (obj) {
            var data = obj.data;
            var layEvent = obj.event;
            if (layEvent === 'tixian') {
                window.location.href='views/index.html#/buss/tixian/list[id='+data.id+']';
            }else if(layEvent === 'lishi'){
                window.location.href='views/index.html#/buss/tixian/list1[id='+data.id+']';
            }
        });

    });
</script>

